/**   
* @Title: StreamUtils.java
* @Package com.jbeer.framework.utils
* @author Bieber
* @date 2014-2-22 下午01:59:03
* @version V1.0   
*/

package com.jbeer.framework.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;


/**
 * <p>类功能说明:IO流的工具类</p>
 * <p>类修改者	    修改日期</p>
 * <p>修改说明</p>
 * <p>Title: StreamUtils.java</p>
 * @author Bieber <a mailto="bieber.jbeer@hotmail.com">bieber.jbeer@hotmail.com</a>
 * @date 2014-2-22 下午01:59:03
 * @version V1.0
 */

public class IOStreamUtils {

	/**
	 * 
	* <p>函数功能说明:NIO的零拷贝</p>
	* <p>Bieber  2014-3-9</p>
	* <p>修改者名字 修改日期</p>
	* <p>修改内容</a>  
	* @return void
	 */
	 public static void copyFile(File src,File dest) throws IOException{
		 FileOutputStream fos = new FileOutputStream(dest);
		 FileInputStream fis = new FileInputStream(src);
		 FileChannel reader = fis.getChannel();
		 FileChannel writer = fos.getChannel();
		 writer.transferFrom(reader, 0, reader.size());
		 reader.close();
		 writer.close();
		 fos.close();
		 fis.close();
	 }
}
